sub addPUBustron( byval t as powerups )

        var curl = ubound(ball)

        redim preserve ball(curl+2)
        ball(curl+1).p = vec2f( rnd*640, rnd*480 )
        ball(curl+1).v = vec2f( rnd*640, rnd*480 )
        ball(curl+1).v.Normalize
        ball(curl+1).s = 150.0
        ball(curl+1).v*= ball(curl+1).s
        ball(curl+1).r = 8
        ball(curl+1).bad = t
        ball(curl+1).col = rgba(0,0,255,255)

        cooldown = timer + 20
        remove_pu_b = RndRange(5,15) + timer

end sub

''******level_up******
sub level_up( byref player as player_struct, balls() as big_hairy_ballxorz_struct, byref add_level as integer )

    cooldown = 0
    shield_active = 0
    sides_active = 0
    growth_rate = 5
    bspeed = 50
    fgrav = 9.8
    if curMessage <> 0 then
        curMessage->start = timer - 1
    end if

    if add_level then

        player.level+=1
        player.lives = player.level + 1

    else

        player.lives -= 1

    end if
    player.selected = -1
    player.max_balls = ((player.level+7)*1.75)+RndRange(5, 10)
    player.timer_level = (player.max_balls * 500)/3

    if player.ball <> null then delete[] player.ball
    player.ball = new big_hairy_ballxorz_struct[ player.max_balls ]

    for i as integer = 0 to player.max_balls - 1

        player.ball[i].active = 0
        player.ball[i].glow = 0

    next

    redim balls( player.level )

    for i as integer = 0 to player.level

        balls(i).p = vec2f( rnd*640, rnd*480 )
        balls(i).v = vec2f( rnd*640, rnd*480 )
        balls(i).v.Normalize
        balls(i).s = 150.0
        balls(i).v*= balls(i).s
        balls(i).r = 8

        balls(i).bad = 1
        var rand_color = RndRange(1,6)
        select case rand_color
        case 1
            balls(i).col = &hfff5deb3
        case 2
            balls(i).col = &hffff7f00
        case 3
            balls(i).col = &hff98ff98
        case 4
            balls(i).col = &hffff69b4
        case 5
            balls(i).col = &hffd2691e
        case else
            balls(i).col = rgba(255,0,0,255)
        end select


    next

    player.level_fill = 70.0 - (player.level / 3)
    line bg_image,(0,0)-(640,480),rgb(0,0,RndRange(30,150)),BF

end sub
